home *** CD-ROM | disk | FTP | other *** search
/ Amiga Packmags / NewsFlash - Issue 03 (1989)(UGA - 17-Bit Software)[a].zip / NewsFlash - Issue 03 (1989)(UGA - 17-Bit Software)[a].adf / sources / libbase.c < prev    next >
C/C++ Source or Header  |  1988-01-19  |  2KB  |  81 lines

  1. /*    Opening and Closings of diverse librarys    */
  2. /*    LibBase.c                    */
  3.  
  4. #include    <libraries/libbase.h>
  5. #include    <intuition/intuition.h>
  6.  
  7.  
  8. struct    DosBase     *DosBase;
  9.  
  10. LONG    ExecBase,GfxBase,MathBase,IntuitionBase,
  11.     MathTransBase,MathIeeeDoubBasBase,LayerBase,ClistBase,
  12.     DiskfontBase,TimerBase,TranslatorBase,ArpBase;
  13.  
  14. OpenLibs(Base)  int     Base;
  15. {
  16.  
  17. if (Base & DOS)         DosBase                 =OpLib("dos");
  18. if (Base & INTUI)       IntuitionBase           =OpLib("intuition");
  19. if (Base & EXEC)        ExecBase                =OpLib("exec");
  20. if (Base & GFX)         GfxBase                 =OpLib("graphics");
  21. if (Base & MATH)        MathBase                =OpLib("mathffp");
  22. if (Base & TRANS)       MathTransBase           =OpLib("mathtrans");
  23. if (Base & IEEE)        MathIeeeDoubBasBase     =OpLib("mathieeedoubbas");
  24. if (Base & LAYER)       LayerBase               =OpLib("layers");
  25. if (Base & CLIST)       ClistBase               =OpLib("clist");
  26. if (Base & FONT)        DiskfontBase            =OpLib("diskfont");
  27. if (Base & TIMER)       TimerBase               =OpLib("timer");
  28. if (Base & SPEECH)      TranslatorBase          =OpLib("translator");
  29. if (Base & ARP)         ArpBase                 =OpLib("arp");
  30.  
  31. }
  32.  
  33. LONG    OpLib(f)        char    *f;
  34. {
  35.     LONG    *b;
  36.     char    ln[40];
  37.  
  38.     strcpy(ln,f);
  39.     strcat(ln,".library");
  40.     if (! (b = OpenLibrary(ln,0) ) )
  41.     {
  42.         printf (" Could not open %s \n ",ln);
  43.         printf (" Aborting ");
  44.         CloseLibs();
  45.         exit();
  46.     }
  47.     return(b);
  48. }
  49.  
  50. CloseLibs()
  51. {
  52.     if (DosBase)            CloseLibrary(DosBase);
  53.     if (ExecBase)           CloseLibrary(ExecBase);
  54.     if (IntuitionBase)      CloseLibrary(IntuitionBase);
  55.     if (GfxBase)            CloseLibrary(GfxBase);
  56.     if (MathBase)           CloseLibrary(MathBase);
  57.     if (MathTransBase)      CloseLibrary(MathTransBase);
  58.     if (MathIeeeDoubBasBase)CloseLibrary(MathIeeeDoubBasBase);
  59.     if (LayerBase)          CloseLibrary(LayerBase);
  60.     if (ClistBase)          CloseLibrary(ClistBase);
  61.     if (DiskfontBase)       CloseLibrary(DiskfontBase);
  62.     if (TimerBase)          CloseLibrary(TimerBase);
  63.     if (TranslatorBase)     CloseLibrary(TranslatorBase);
  64.     if (ArpBase)            CloseLibrary(ArpBase);
  65. }
  66.  
  67. main()
  68. {
  69.     int    i;
  70.  
  71.     OpenLibs( DOS | EXEC | INTUI );
  72.     for (i=0; i<10; i++)
  73.     {
  74.         Delay(10);
  75.         printf("%d \n",i);
  76.         if (i==5) DisplayBeep(NULL);
  77.     }
  78.     CloseLibs();
  79. }
  80.  
  81.